package sourceagile.server.localFileRepository;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;

public class ReadLocalFile {

	public static String readFile(String projectName, String filePath) {

		String projectPath = System.getProperty("java.io.tmpdir") + "/"
				+ projectName;

		BufferedReader reader;

		StringBuilder stringBuilder = new StringBuilder();

		try {
			reader = new BufferedReader(new FileReader(projectPath + "/"
					+ filePath));

			String line = null;

			String ls = System.getProperty("line.separator");

			while ((line = reader.readLine()) != null) {

				stringBuilder.append(line);
				stringBuilder.append(ls);
			}

		} catch (IOException e) {

			e.printStackTrace();
		}

		return stringBuilder.toString();
	}

}
